﻿using System;

namespace Sustainalytics.Entities.ProductInvolvement
{
	public class PIDataSource
	{
		public virtual PIDataSourceType Type
		{
			get;
			set;
		}

		public virtual string Name
		{
			get;
			set;
		}
        public static PIDataSource FromStrings(string type, string name)
        {
            var result = new PIDataSource();

            if (!string.IsNullOrEmpty(name) && !string.IsNullOrWhiteSpace(name))
                result.Name = name;

            PIDataSourceType res;
            if (Enum.TryParse<PIDataSourceType>(type, true, out res))
                result.Type = res;
      
            return result;
        }

	}
}

